home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / shaw / vbits16 / mainfrm.cpp next >
Encoding:
C/C++ Source or Header  |  1994-12-13  |  2.8 KB  |  118 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "vbits16.h"
  6.  
  7. #include "mainfrm.h"
  8.  
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char BASED_CODE THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CMainFrame
  16.  
  17. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  18.  
  19. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  20.     //{{AFX_MSG_MAP(CMainFrame)
  21.         // NOTE - the ClassWizard will add and remove mapping macros here.
  22.         //    DO NOT EDIT what you see in these blocks of generated code !
  23.     ON_WM_CREATE()
  24.     //}}AFX_MSG_MAP
  25.     // Global help commands
  26.     ON_COMMAND(ID_HELP_INDEX, CMDIFrameWnd::OnHelpIndex)
  27.     ON_COMMAND(ID_HELP_USING, CMDIFrameWnd::OnHelpUsing)
  28.     ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp)
  29.     ON_COMMAND(ID_CONTEXT_HELP, CMDIFrameWnd::OnContextHelp)
  30.     ON_COMMAND(ID_DEFAULT_HELP, CMDIFrameWnd::OnHelpIndex)
  31. END_MESSAGE_MAP()
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // arrays of IDs used to initialize control bars
  35.  
  36. // toolbar buttons - IDs are command buttons
  37. static UINT BASED_CODE buttons[] =
  38. {
  39.     // same order as in the bitmap 'toolbar.bmp'
  40.     ID_FILE_NEW,
  41.     ID_FILE_OPEN,
  42.     ID_FILE_SAVE,
  43.         ID_SEPARATOR,
  44.     ID_EDIT_CUT,
  45.     ID_EDIT_COPY,
  46.     ID_EDIT_PASTE,
  47.         ID_SEPARATOR,
  48.     ID_FILE_PRINT,
  49.     ID_APP_ABOUT,
  50.     ID_CONTEXT_HELP,     
  51.         ID_SEPARATOR,
  52.     ID_VIEW_NEWDIALOG,
  53. };
  54.  
  55. static UINT BASED_CODE indicators[] =
  56. {
  57.     ID_SEPARATOR,           // status line indicator
  58.     ID_INDICATOR_CAPS,
  59.     ID_INDICATOR_NUM,
  60.     ID_INDICATOR_SCRL,
  61. };
  62.  
  63. /////////////////////////////////////////////////////////////////////////////
  64. // CMainFrame construction/destruction
  65.  
  66. CMainFrame::CMainFrame()
  67. {
  68.     // TODO: add member initialization code here
  69. }
  70.  
  71. CMainFrame::~CMainFrame()
  72. {
  73. }
  74.  
  75. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  76. {
  77.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  78.         return -1;
  79.  
  80.     if (!m_wndToolBar.Create(this) ||
  81.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  82.         !m_wndToolBar.SetButtons(buttons,
  83.           sizeof(buttons)/sizeof(UINT)))
  84.     {
  85.         TRACE("Failed to create toolbar\n");
  86.         return -1;      // fail to create
  87.     }
  88.  
  89.     if (!m_wndStatusBar.Create(this) ||
  90.         !m_wndStatusBar.SetIndicators(indicators,
  91.           sizeof(indicators)/sizeof(UINT)))
  92.     {
  93.         TRACE("Failed to create status bar\n");
  94.         return -1;      // fail to create
  95.     }
  96.  
  97.     return 0;
  98. }
  99.  
  100. /////////////////////////////////////////////////////////////////////////////
  101. // CMainFrame diagnostics
  102.  
  103. #ifdef _DEBUG
  104. void CMainFrame::AssertValid() const
  105. {
  106.     CMDIFrameWnd::AssertValid();
  107. }
  108.  
  109. void CMainFrame::Dump(CDumpContext& dc) const
  110. {
  111.     CMDIFrameWnd::Dump(dc);
  112. }
  113.  
  114. #endif //_DEBUG
  115.  
  116. /////////////////////////////////////////////////////////////////////////////
  117. // CMainFrame message handlers
  118.